package example.collections;

import java.io.IOException;
import java.util.Arrays;
import java.util.List;

/**
 * Created by lenovo on 2016/11/7 0007.
 * Java Util 类的 Arrays.asList(name) 方法将数组转换为集合
 */
public class ArrayToList {
    public static void main(String args[])
            throws IOException {
        int n = 5;         // 5 个元素
        String[] name = new String[n];
        for (int i = 0; i < n; i++) {
            name[i] = String.valueOf(i);
        }
        List<String> list = Arrays.asList(name);
        System.out.println();
        for (String li : list) {
            System.out.print(li + " ");
        }
    }
}
